#ifndef ControlUtil_h__
#define ControlUtil_h__

#include "cocos2d.h"
#include "cocos-ext.h"
using namespace cocos2d;
USING_NS_CC_EXT;
class ControlUtil
{
public:
	static CCControlButton* scale9Button(
		const char* normalFile, 
		const char* hightFile,
		const char* title,
		const char* fontName,
		float fontSize,
		ccColor3B& fontColor)
	{
		CCScale9Sprite *backgroundButton = CCScale9Sprite::create(normalFile);
		CCScale9Sprite *backgroundHighlightedButton = CCScale9Sprite::create(hightFile);

		CCLabelTTF *titleButton = CCLabelTTF::create(title, fontName, fontSize);

		titleButton->setColor(fontColor);

		CCControlButton *button = CCControlButton::create(titleButton, backgroundButton);
		button->setBackgroundSpriteForState(backgroundHighlightedButton, CCControlStateHighlighted);

		return button;
	}
};
#define scale9Button(normalFile,hightFile,title,fontName,fontSize,fontColor) \
	ControlUtil::scale9Button(normalFile,hightFile,title,fontName,fontSize,fontColor)
#endif // ControlUtil_h__
